import Vue from 'vue'
import VueRouter from 'vue-router'
import MyLogin from '@/views/MyLogin'
import MyLayout from '@/views/MyLayout'
import MyIndex from '@/views/MyIndex'
import OperationSheet from '@/views/worksheet/OperationSheet'
import OperationsWork from '@/views/worksheet/OperationsWork'
import AreaOrder from '@/views/dianwei/AreaOrder'
import PartnerOrder from '@/views/dianwei/PartnerOrder'
import PointOrder from '@/views/dianwei/PointOrder'
import DeviceOrder from '@/views/shebei/DeviceOrder'
import StateOrder from '@/views/shebei/StateOrder'
import TypeOrder from '@/views/shebei/TypeOrder'
import CountList from '@/views/renyuan/CountList'
import PeopleList from '@/views/renyuan/PeopleList'
import WorkLoad from '@/views/renyuan/WorkLoad'
import GoodsManage from '@/views/shangping/GoodsManage'
import GoodsType from '@/views/shangping/GoodsType'
import StrategyManage from '@/views/celue/StrategyManage'
import MenuManage from '@/views/dingdan/MenuManage'
import AccountsManage from '@/views/duizhang/AccountsManage'
// import { getToken } from '@/utils/storage'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: MyLayout,
    redirect: '/index',
    children: [
      {
        path: '/index',
        component: MyIndex
      },
      {
        path: '/operation',
        component: OperationSheet
      },
      {
        path: '/operationswork',
        component: OperationsWork
      },
      {
        path: '/areaorder',
        component: AreaOrder
      },
      {
        path: '/partnerorder',
        component: PartnerOrder
      },
      {
        path: '/pointorder',
        component: PointOrder
      },
      {
        path: '/deviceorder',
        component: DeviceOrder
      },
      {
        path: '/stateorder',
        component: StateOrder
      },
      {
        path: '/typeorder',
        component: TypeOrder
      },
      {
        path: '/countlist',
        component: CountList
      },
      {
        path: '/peoplelist',
        component: PeopleList
      },
      {
        path: '/workload',
        component: WorkLoad
      },
      {
        path: '/goodsmanage',
        component: GoodsManage
      },
      {
        path: '/goodstype',
        component: GoodsType
      },
      {
        path: '/strategymanage',
        component: StrategyManage
      },
      {
        path: '/menumanage',
        component: MenuManage
      },
      {
        path: '/accountsmanage',
        component: AccountsManage
      }
    ]
  },
  {
    path: '/login',
    component: MyLogin
  }
]

const router = new VueRouter({
  routes
})

// const whiteList = ['/login']
// router.beforeEach((to, from, next) => {
//   const token = getToken()
//   if (token) {
//     next()
//   } else {
//     if (whiteList.includes(to.path)) {
//       next()
//     } else {
//       next('/login')
//     }
//   }
// })
export default router
